package com.xique.door.service.impl.estate;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xique.door.bean.dao.estate.EstateUserDeviceListDAO;
import com.xique.door.bean.domain.estate.EstateUserDevice;
import com.xique.door.mapper.estate.EstateUserDeviceMapper;
import com.xique.door.service.estate.IEstateUserDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shd
 * @create 2022/6/9 16:07
 */
@Service
public class EstateUserDeviceServiceImpl extends ServiceImpl<EstateUserDeviceMapper, EstateUserDevice> implements IEstateUserDeviceService {

    @Autowired
    private EstateUserDeviceMapper estateUserDeviceMapper;

    @Override
    public List<EstateUserDeviceListDAO> listByUserIds(List<Long> userIds) {
        if (CollectionUtil.isEmpty(userIds)) {
            return new ArrayList<>();
        }
        return estateUserDeviceMapper.listByUserIds(userIds);
    }

    @Override
    public void deleteByUserId(Long id) {
        estateUserDeviceMapper.deleteByUserId(id);
    }
}
